rasterzones!
rasterzones!(GI::GItype, shapes::Vector{GMTdataset}, fun::Function)
keywords: GMT, Julia, zonal statistics
Apply a unidimensional function fun to to the elements of the grid or image GI that lies inside the polygons of the GMTdataset shapes. The GI array is modified in place.
GI: A grid (GMTgrid) or image (GMTimage) type that will be modified by applyingfunto the elements that fall inside the polygons ofshapes.
shapes: A vector of GMTdataset containing the polygons inside which the elements ifGIwill be assigned a single value obtained by applying the functionfun.
fun: A unidemensional function name used to compute the contant value for theGIelements that fall inside each of the polygons ofshapes.
Returns
It does't return anything but the input GI is modified.
Examples
Take the Peaks grid and replace the elements that fall inside a triangle at the center by their average.
using GMT
G = GMT.peaks();
D = mat2ds([-1 -1; 0 1; 1 -1; -1 -1]);
rasterzones!(G, D, mean)
viz(G)
See Also
colorzones!These docs were autogenerated using GMT: v1.23.0